package com.gm.mapper;

import com.gm.bean.Admin;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.web.bind.annotation.DeleteMapping;

import java.util.List;

public interface AdminMapper {
    @Select("select * from tb_admininfo where nickname=#{nickname}")
    Admin getAdminByName(String nickname);
    @Select("select * from tb_admininfo")
    List<Admin> findAdminAll(Integer page, Integer size);
    @Insert("insert into tb_admininfo(nickname,password,realname,phone,gender,age,createTime,updateTime) values(#{nickname},#{password},#{realname},#{phone},#{gender},#{age},#{createTime},#{updateTime})")
    void addAdmin(Admin admin);
    @Delete("delete from tb_admininfo where id = #{id}")
    void delAdmin(Integer id);
    @Update("update tb_admininfo set nickname=#{nickname},password=#{password},realname=#{realname},phone=#{phone},gender=#{gender},age=#{age} where id= #{id}")
    void adminUpd(Admin admin);
}
